package com.hfh.test;

/**
 * @Author hfh
 * @Date 2022 09 15 11 12
 **/
public class Worker implements Comparable<Worker>{
    private String name;
    private Integer age;
    private String salary;

    @Override
    public int compareTo(Worker o) {
        if (age!=o.age){
            return age-o.age;
        }else {
            return name.compareTo(o.name);
        }
    }

    @Override
    public String toString() {
        return "Worker{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", salary='" + salary + '\'' +
                '}';
    }

    public Worker(String name, Integer age, String salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSalary() {
        return salary;
    }

    public void setSalary(String salary) {
        this.salary = salary;
    }



}
